package hhAcademicBowl;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.JPanel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class summaryScreen {

	private JFrame frame;
	int redScore, blackScore;

	/**
	 * Create the application.
	 */
	public summaryScreen(int rs, int bs) {
		redScore = rs;
		blackScore = bs;
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setBackground(ColorConstants.BG);
		frame.getContentPane().setLayout(null);
		Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
		frame.setBounds(0,0,screen.width,screen.height);
		frame.setUndecorated(true); //maximized
		
		JLabel lblTitle = new JLabel("HH Academic Bowl");
		lblTitle.setHorizontalAlignment(SwingConstants.LEFT);
		lblTitle.setFont(new Font("Impact", Font.PLAIN, 69));
		lblTitle.setBounds((frame.getWidth()-525)/2, 10, 525, 68); //title position
		frame.getContentPane().add(lblTitle);
		
		JPanel redPanel = new JPanel();
		redPanel.setBackground(ColorConstants.BG);
		redPanel.setBounds(10, 91, (frame.getWidth() - 20)/2, (frame.getHeight() - 100) );
		frame.getContentPane().add(redPanel);
		redPanel.setLayout(null);
		
		JLabel lblRedTotalScore = new JLabel("RED TOTAL SCORE:");
		lblRedTotalScore.setHorizontalAlignment(SwingConstants.CENTER);
		lblRedTotalScore.setBounds(0, 0, redPanel.getWidth(), 66);
		redPanel.add(lblRedTotalScore);
		lblRedTotalScore.setFont(new Font("Impact", Font.PLAIN, 60));
		
		JLabel lblRedscore = new JLabel(Integer.toString(redScore));
		lblRedscore.setHorizontalAlignment(SwingConstants.CENTER);
		lblRedscore.setFont(new Font("Impact", Font.PLAIN, 99));
		lblRedscore.setBounds(0, 0, redPanel.getWidth(), redPanel.getHeight());
		redPanel.add(lblRedscore);
		
		JPanel blackPanel = new JPanel();
		blackPanel.setBackground(ColorConstants.BG);
		blackPanel.setBounds(10 + redPanel.getWidth(), 91, (frame.getWidth() - 20)/2, (frame.getHeight() - 100) );
		frame.getContentPane().add(blackPanel);
		blackPanel.setLayout(null);
		
		JLabel lblBlackTotalScore = new JLabel("BLACK TOTAL SCORE:");
		lblBlackTotalScore.setHorizontalAlignment(SwingConstants.CENTER);
		lblBlackTotalScore.setBounds(0, 0, blackPanel.getWidth(), 66);
		blackPanel.add(lblBlackTotalScore);
		lblBlackTotalScore.setFont(new Font("Impact", Font.PLAIN, 60));
		
		JLabel lblBlackscore = new JLabel(Integer.toString(blackScore));
		lblBlackscore.setHorizontalAlignment(SwingConstants.CENTER);
		lblBlackscore.setFont(new Font("Impact", Font.PLAIN, 99));
		lblBlackscore.setBounds(0, 0, blackPanel.getWidth(), blackPanel.getHeight());
		blackPanel.add(lblBlackscore);
		
		
		JButton btnClose = new JButton("End Game");
		btnClose.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				frame.dispose();
				System.exit(0);
			}
		});
		btnClose.setFont(new Font("Tahoma", Font.PLAIN, 23));
		btnClose.setBounds(442, 608, 188, 60);
		blackPanel.add(btnClose);
		
		frame.setVisible(true);
	}
}
